package ms.authority.controller;

import ms.authority.entity.Permission;
import ms.authority.service.PermissionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;
import java.util.List;

/**
 * Project Name: ms
 * File Name: PermissionController
 * Package Name: ms.authority.controller
 * Date: 2018/5/7  14:47
 * Copyright (c) 2018, tianyul All Rights Reserved.
 * 权限
 */
@RestController
@RequestMapping("/permission")
public class PermissionController {

    @Autowired
    private PermissionService permissionService;

    @PostMapping("/list")
    public List<Permission> list() throws IOException {
        return permissionService.getList();
    }

    /**
     * 清空权限缓存
     */
    @PostMapping("/clean")
    public void clean() {
        permissionService.clean();
    }
}
